<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>01_外间距测试</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .fu{
            background-color: rgba(255,255,0,.3);
            overflow: hidden;/*形成bfc结界*/
        }
        .fu>div{
            width: 100px;
            height: 100px;
            background-color: rgba(0,0,255,.6);
            border: 2px solid #00f;
            color: #fff;
            font-size: 25px;
            font-weight: bold;
        }
        .z1{
            margin-bottom: 30px;
            margin-top: 50px;
        }
        .z2{
            /*1.垂直方向上，相邻兄弟之间的外间距取大值显示*/
            margin-top: 50px;
        }
        .z4{
            margin-bottom: 50px;
        }
        .z3{
            margin: 10px;
            margin: 10px 20px;
            margin: 10px 20px 30px;
            margin: 10px 20px 30px 40px;
            /*实现块级元素自身的水平居中*/
            margin: 0 auto;
        }
        .s2{
            /*行内元素垂直方向的外间距不生效*/
            margin: 30px;
        }
    </style>
</head>
<body>
<span>span1</span><span class="s2">span2</span><span>span3</span>
<div class="fu">
    <div class="z1">111</div>
    <div class="z2">222</div>
    <div class="z3">333</div>
    <div class="z4">444</div>
</div>
</body>
</html>